<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>学生档案管理系统 - 新生档案管理 </title>
    <meta name="Copyright" content="Douco Design."/>
    <link href="${pageContext.request.contextPath}/css/public.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/global.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.tab.js"></script>
</head>
<body>
<div id="dcWrap">
    <div id="dcHead">
        <div id="head">
            <div class="logo"><a href="index.jsp"></a></div>
            <div class="nav">
                <ul class="navRight">
                    <c:choose>
                        <c:when test="${sessionScope.userInfo.basicinformationRole=='教师'}">
                            <li>
                                当前用户：${sessionScope.userInfo.basicinformationRole}:${sessionScope.userInfo.teacherName}</li>
                        </c:when>
                        <c:otherwise>
                            <li>
                                当前用户：${sessionScope.userInfo.basicinformationRole}:${sessionScope.userInfo.basicinformationName}</li>
                        </c:otherwise>
                    </c:choose>
                    <li class="noRight"><a href="${pageContext.request.contextPath}/login/loginOut.action">退出</a></li>
                </ul>
            </div>
        </div>
    </div>
    <!-- dcHead 结束 -->
    <div id="dcLeft">
        <div id="menu">
            <ul class="top">
                <li><a href="${pageContext.request.contextPath}/index.jsp"><i class="home"></i><em>管理首页</em></a></li>
            </ul>
            <ul>
                <c:choose>
                    <c:when test="${sessionScope.userInfo.basicinformationRole=='教师' && sessionScope.userInfo.teacherType == 1}">
                        <li><a href="${pageContext.request.contextPath }/basicinformation/selectLimit.action">
                            <i class="system"></i><em>新生档案管理</em></a>
                        </li>
                    </c:when>
                    <c:when test="${sessionScope.userInfo.basicinformationRole=='学生'}">
                        <li><a href="${pageContext.request.contextPath }/basicinformation/selectLimit.action"><i
                                class="system"></i><em>新生档案管理</em></a></li>
                    </c:when>
                </c:choose>
                <c:choose>
                    <c:when test="${sessionScope.userInfo.basicinformationRole=='教师'}">

                        <li><a href="${pageContext.request.contextPath}/achievement/selectLimit.action">
                            <i class="nav"></i><em>在校管理</em></a></li>
                    </c:when>
                    <c:otherwise>
                        <li><a href="${pageContext.request.contextPath}/achievement/selectLimitStu.action">
                            <i class="nav"></i><em>在校管理</em></a></li>

                    </c:otherwise>
                </c:choose>
                <c:choose>
                    <c:when test="${sessionScope.userInfo.basicinformationRole=='教师' && sessionScope.userInfo.teacherType == 1}">
                        <li><a href="${pageContext.request.contextPath }/graduation/selectLimit.action"><i
                                class="show"></i><em>毕业管理</em></a></li>
                    </c:when>
                    <c:when test="${sessionScope.userInfo.basicinformationRole=='学生'}">
                        <li><a href="${pageContext.request.contextPath }/graduation/selectLimitStu.action"><i
                                class="show"></i><em>毕业管理</em></a></li>
                    </c:when>
                </c:choose>
            </ul>
        </div>
    </div>

    <div id="dcMain">
        <!-- 当前位置 -->
        <div id="urHere">毕业生档案管理系统<b>></b><strong>新生档案管理</strong></div>
        <div class="mainBox" style="height:auto!important;height:550px;min-height:550px;">
            <h3>新生档案管理</h3>
            <script type="text/javascript">

                $(function () {
                    $(".idTabs").idTabs();
                });

            </script>
            <div class="idTabs">
                <ul class="tab">

                    <c:choose>
                        <c:when test="${sessionScope.userInfo.basicinformationRole=='教师' && sessionScope.userInfo.teacherType == 1}">
                            <li><a href="#defined">导出学生信息</a></li>
                            <li><a href="#increase">批量导入</a></li>
                            <li><a href="#supplement">补充基本信息</a></li>
                        </c:when>
                        <c:when test="${sessionScope.userInfo.basicinformationRole=='学生'}">
                            <li><a href="#supplement">补充基本信息</a></li>
                        </c:when>
                    </c:choose>
                </ul>
                <div class="items">
                    <c:choose>
                        <c:when test="${sessionScope.userInfo.basicinformationRole=='教师' && sessionScope.userInfo.teacherType == 1}">
                            <!--导出学生信息-->
                            <div id="defined">
                                <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
                                    <form action="${pageContext.request.contextPath }/basicinformation/selectLimit.action"
                                          method="post">
                                        <tr>
                                            <td colspan="14" align="right">
                                                <input type="text" name="keywords" title="请输入姓名">
                                                <input type="submit" value="搜索">
                                            </td>
                                        </tr>
                                    </form>
                                    <tr>
                                        <th width="20">序号</th>
                                        <th>姓名</th>
                                        <th>学号</th>
                                        <th>身份证号</th>
                                        <th>院系</th>
                                        <th>专业班级</th>
                                        <th>性别</th>
                                        <th>民族</th>
                                        <th>籍贯</th>
                                        <th>出生地</th>
                                        <th>生源地</th>
                                        <th>考生号</th>
                                        <th>家庭住址</th>
                                        <th>贷款金额</th>
                                        <th>贷款回执单</th>
                                        <th>贷款类型</th>
                                    </tr>
                                    <c:forEach items="${basicinformationPage.list}" var="list" varStatus="pageIndex">
                                        <tr>
                                            <td>${pageIndex.count}</td>
                                            <td>${list.basicinformationName}</td>
                                            <td>${list.basicinformationId}</td>
                                            <td>${list.basicinformationIcard}</td>
                                            <td>${list.institute.instituteName}</td>
                                            <td>${list.basicinformationClass}</td>
                                            <td>${list.basicinformationSex}</td>
                                            <td>${list.basicinformationNation}</td>
                                            <td>${list.basicinformationNativeplace}</td>
                                            <td>${list.basicinformationBirthplace}</td>
                                            <td>${list.basicinformationSorigin}</td>
                                            <td>${list.basicinformationCandidatenumber}</td>
                                            <td>${list.basicinformationHome}</td>
                                            <c:choose>
                                                <c:when test="${!empty list.loanAmount}">
                                                    <td>${list.loanAmount}</td>
                                                </c:when>
                                                <c:otherwise>
                                                    <td>未贷款</td>
                                                </c:otherwise>
                                            </c:choose>
                                            <c:choose>
                                                <c:when test="${!empty list.loanNumber}">
                                                    <td>${list.loanNumber}</td>
                                                </c:when>
                                                <c:otherwise>
                                                    <td>未贷款</td>
                                                </c:otherwise>
                                            </c:choose>
                                            <c:choose>
                                                <c:when test="${!empty list.loanType}">
                                                    <td>${list.loanType}</td>
                                                </c:when>
                                                <c:otherwise>
                                                    <td>未贷款</td>
                                                </c:otherwise>
                                            </c:choose>
                                        </tr>
                                    </c:forEach>
                                    <tr>
                                        <td colspan="13" align="center">
                                            第${basicinformationPage.pageIndex }/${basicinformationPage.pageCount }页
                                            &nbsp;&nbsp;
                                            <a href="${pageContext.request.contextPath }/basicinformation/selectLimit.action?pageIndex=1">首页</a>
                                            <c:choose>
                                                <c:when test="${basicinformationPage.pageIndex > 1}">
                                                    <a href="${pageContext.request.contextPath }/basicinformation/selectLimit.action?pageIndex=${basicinformationPage.pageIndex - 1}">上一页</a>
                                                </c:when>
                                                <c:otherwise>
                                                    上一页
                                                </c:otherwise>
                                            </c:choose>

                                            <c:choose>
                                                <c:when test="${basicinformationPage.pageIndex  < basicinformationPage.pageCount}">
                                                    <a href="${pageContext.request.contextPath }/basicinformation/selectLimit.action?pageIndex=${basicinformationPage.pageIndex + 1}">下一页</a>
                                                </c:when>
                                                <c:otherwise>
                                                    下一页
                                                </c:otherwise>
                                            </c:choose>
                                            <a href="${pageContext.request.contextPath }/basicinformation/selectLimit.action?pageIndex=${basicinformationPage.pageCount}">尾页</a>
                                        </td>
                                    </tr>
                                    <form action="${pageContext.request.contextPath}/basicinformation/selectExport.action"
                                          method="post" enctype="multipart/form-data">
                                        <input type="hidden" name="keyword"
                                               value="${basicinformationPage.paramEntity.basicinformationName}">
                                        <tr>
                                            <td>
                                                <input class="btn" type="submit" value="导出学生信息"/>
                                            </td>

                                        </tr>
                                    </form>
                                </table>
                            </div>
                            <!-- 批量导入 -->
                            <div id="increase">
                                <form action="${pageContext.request.contextPath}/basicinformation/insertExcel.action"
                                      method="post" enctype="multipart/form-data">
                                    <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
                                        <tr>
                                            <th width="131">名称</th>
                                            <th>内容</th>
                                        </tr>

                                        <tr>
                                            <td align="right">学生基本信息表</td>
                                            <td>
                                                <input type="file" name="student" size="18"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td></td>
                                            <td>
                                                <input name="submit" class="btn" type="submit" value="提交"/>
                                            </td>
                                            <div style="color:red;width: 100%;text-align: center">${messageBasicinformation}</div>

                                        </tr>
                                    </table>
                                </form>
                            </div>
                            <!--补充基本信息-->
                            <div id="supplement">
                                <label for="searchTxt"></label><input type="text" placeholder="请输入学号" id="searchTxt" /> <button onclick="searchBtn()">搜索</button>
                                <script type="text/javascript">
                                    function searchBtn() {
                                        var searchId = $("#searchTxt").val();
                                        $.ajax({
                                            url: "/record/basicinformation/selectById.action",
                                            type: "post",
                                            data: "searchId="+searchId,
                                            async:false,
                                            success: function (data) {
                                                $("#inpMain").val(data.basicinformationName);
                                                $("#HiddenId").val(data.basicinformationId);
                                                if (data.basicinformationSex === "男"){
                                                    $("#supplement_0").attr("checked",true);
                                                }else {
                                                    $("#supplement_1").attr("checked",true);
                                                }
                                                if ($("#selName").val() === data.instituteNume){
                                                    $("#selName").attr("selected",selected);
                                                }
                                                $("#inpPhone").val(data.basicinformationPhone);
                                                $("#inpIard").val(data.basicinformationIcard);
                                                $("#inpNation").val(data.basicinformationNation);
                                                $("#inpBirthplace").val(data.basicinformationBirthplace);
                                                $("#inpNativeplace").val(data.basicinformationNativeplace);
                                                $("#inpPassword").val(data.basicinformationPassword);
                                                $("#inpClass").val(data.basicinformationClass);
                                                $("#inpHome").val(data.basicinformationHome);
                                                $("#inpSorigin").val(data.basicinformationSorigin);
                                                $("#inpdatenumber").val(data.basicinformationCandidatenumber);
                                                $("#inploanAmount").val(data.loanAmount);
                                                $("#inploanNumber").val(data.loanNumber);
                                                if ($("#selloanType").val() === data.loanType){
                                                    $("#selloanType").attr("selected",selected);
                                                }
                                            },
                                            error: function () {
                                                alert("系统错误，请稍候。。。。")
                                            }
                                        });
                                    }
                                </script>
                                <form action="${pageContext.request.contextPath}/basicinformation/updateStu.action"
                                      method="post">
                                    <input type="hidden" id="HiddenId" name="basicinformationId" />
                                    <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
                                        <tr>
                                            <th width="131">名称</th>
                                            <th>内容</th>
                                        </tr>
                                        <tr>
                                            <td align="right">姓名</td>
                                            <td>
                                                <input type="text" name="basicinformationName" size="80"
                                                       class="inpMain" id="inpMain"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">性别</td>
                                            <td>
                                                <label for="supplement_0">
                                                    <input type="radio" name="basicinformationSex" id="supplement_0"
                                                           value="0">
                                                    男</label>
                                                <label for="supplement_1">
                                                    <input type="radio" name="basicinformationSex" id="supplement_1"
                                                           value="1">
                                                    女</label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">院系</td>
                                            <td>
                                                <label>
                                                    <select name="instituteNume" id="selName">
                                                        <c:forEach items="${applicationScope.instituteList}"
                                                                   var="institute">
                                                            <option value="${institute.instituteNume}">${institute.instituteName}</option>
                                                        </c:forEach>
                                                    </select>
                                                </label>

                                            </td>
                                        </tr>

                                        <tr>
                                            <td align="right">电话</td>
                                            <td>
                                                <input type="text" name="basicinformationPhone" value="" size="80"
                                                       class="inpMain" id="inpPhone"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">身份证号</td>
                                            <td>
                                                <input type="text" name="basicinformationIcard" size="80"
                                                       class="inpMain" id="inpIard" readonly="readonly"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">民族</td>
                                            <td>
                                                <input type="text" name="basicinformationNation" value="" size="80"
                                                       class="inpMain" id="inpNation" readonly="readonly"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">出生地</td>
                                            <td>
                                                <input type="text" name="basicinformationBirthplace" value="" size="80"
                                                       class="inpMain" id="inpBirthplace" readonly="readonly"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">籍贯</td>
                                            <td>
                                                <input type="text" name="basicinformationNativeplace" value="" size="80"
                                                       class="inpMain" id="inpNativeplace" readonly="readonly"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">密码</td>
                                            <td>
                                                <input type="password" name="basicinformationPassword" value=""
                                                       size="80"
                                                       class="inpMain" id="inpPassword"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">年级专业班级</td>
                                            <td>
                                                <input type="text" name="basicinformationClass" value="" size="80"
                                                       class="inpMain" id="inpClass"/>
                                            </td>
                                        </tr>


                                        <tr>
                                            <td align="right">家庭住址</td>
                                            <td>
                                                <input type="text" name="basicinformationHome" value="" size="80"
                                                       class="inpMain" id="inpHome"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">生源地</td>
                                            <td>
                                                <input type="text" name="basicinformationSorigin" value="" size="80"
                                                       class="inpMain" id="inpSorigin" readonly="readonly"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">考生号</td>
                                            <td>
                                                <input type="text" name="basicinformationCandidatenumber" value=""
                                                       size="80"
                                                       class="inpMain" id="inpdatenumber" readonly="readonly"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">贷款金额</td>
                                            <td>
                                                <input type="text" name="loanAmount" value=""
                                                       size="80"
                                                       class="inpMain" id="inploanAmount"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">贷款回执单号</td>
                                            <td>
                                                <input type="text" name="loanNumber" value=""
                                                       size="80"
                                                       class="inpMain" id="inploanNumber"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">贷款类型</td>
                                            <td>
                                                <label>
                                                    <select name="loanType" id="selloanType">
                                                            <option value="农村信用社">农村信用社</option>
                                                            <option value="开发银行">开发银行</option>
                                                    </select>
                                                </label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <input name="submit" class="btn" type="submit" value="确认修改"/>
                                            </td>
                                            <td>
                                                <p>${requestScope.message}</p>
                                            </td>

                                        </tr>

                                    </table>
                                </form>
                            </div>
                        </c:when>
                        <c:when test="${sessionScope.userInfo.basicinformationRole=='学生'}">
                            <!--补充基本信息-->
                            <div id="supplement">
                                <form action="${pageContext.request.contextPath}/basicinformation/updateStu.action"
                                      method="post">
                                    <input type="hidden" name="basicinformationId" value="${sessionScope.userInfo.basicinformationId}" />
                                    <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">

                                        <tr>
                                            <th width="131">名称</th>
                                            <th>内容</th>
                                        </tr>
                                        <tr>
                                            <td align="right">姓名</td>
                                            <td>
                                                <input type="text" name="basicinformationName" size="80"
                                                       class="inpMain" value="${sessionScope.userInfo.basicinformationName}"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">性别</td>
                                            <td>
                                            <c:choose>
                                                <c:when test="${sessionScope.userInfo.basicinformationSex == '男'}">
                                                    <label for="supplement_0">
                                                        <input type="radio" name="basicinformationSex" id="supplement_0"
                                                               value="0"
                                                               checked="true" readonly="readonly">
                                                        男</label>
                                                    <label for="supplement_1">
                                                        <input type="radio" name="basicinformationSex" id="supplement_1"
                                                               value="1" readonly="readonly">
                                                        女</label>
                                                </c:when>
                                                <c:otherwise>
                                                    <label for="supplement_0">
                                                        <input type="radio" name="basicinformationSex" id="supplement_0"
                                                               value="0" readonly="readonly">
                                                        男</label>
                                                    <label for="supplement_1">
                                                        <input type="radio" name="basicinformationSex" id="supplement_1"
                                                               value="1" checked="true" readonly="readonly">
                                                        女</label>
                                                </c:otherwise>
                                            </c:choose>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">院系</td>
                                            <td>
                                                <label>
                                                    <select name="instituteNume">
                                                        <c:forEach items="${applicationScope.instituteList}"
                                                                   var="institute">
                                                            <c:if test="${sessionScope.userInfo.instituteNume eq institute.instituteNume}">
                                                                <option value="${institute.instituteNume}" selected="selected">${institute.instituteName}</option>
                                                            </c:if>
                                                            <option value="${institute.instituteNume}">${institute.instituteName}</option>
                                                        </c:forEach>
                                                    </select>
                                                </label>
                                            </td>
                                        </tr>

                                        <tr>
                                            <td align="right">电话</td>
                                            <td>
                                                <label>
                                                    <input type="text" name="basicinformationPhone" value="${sessionScope.userInfo.basicinformationPhone}" size="80"
                                                           class="inpMain"/>
                                                </label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">身份证号</td>
                                            <td>
                                                <input type="text" name="basicinformationIcard" size="80"
                                                       class="inpMain" readonly="readonly" value="${sessionScope.userInfo.basicinformationIcard}"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">民族</td>
                                            <td>
                                                <input type="text" name="basicinformationNation" value="${sessionScope.userInfo.basicinformationNation}" size="80"
                                                       class="inpMain" readonly="readonly"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">出生地</td>
                                            <td>
                                                <input type="text" name="basicinformationBirthplace" value="${sessionScope.userInfo.basicinformationBirthplace}" size="80"
                                                       class="inpMain" readonly="readonly"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">籍贯</td>
                                            <td>
                                                <input type="text" name="basicinformationNativeplace" value="${sessionScope.userInfo.basicinformationNativeplace}" size="80"
                                                       class="inpMain" readonly="readonly"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">密码</td>
                                            <td>
                                                <input type="password" name="basicinformationPassword" value="${sessionScope.userInfo.basicinformationPassword}"
                                                       size="80"
                                                       class="inpMain"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">年级专业班级</td>
                                            <td>
                                                <input type="text" name="basicinformationClass" value="${sessionScope.userInfo.basicinformationClass}" size="80"
                                                       class="inpMain"/>
                                            </td>
                                        </tr>


                                        <tr>
                                            <td align="right">家庭住址</td>
                                            <td>
                                                <input type="text" name="basicinformationHome" value="${sessionScope.userInfo.basicinformationHome}" size="80"
                                                       class="inpMain"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">生源地</td>
                                            <td>
                                                <input type="text" name="basicinformationSorigin" value="${sessionScope.userInfo.basicinformationSorigin}" size="80"
                                                       class="inpMain" readonly="readonly"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">考生号</td>
                                            <td>
                                                <input type="text" name="basicinformationCandidatenumber" value="${sessionScope.userInfo.basicinformationCandidatenumber}"
                                                       size="80"
                                                       class="inpMain" readonly="readonly"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">贷款金额</td>
                                            <td>
                                                <input type="text" name="loanAmount" value="${sessionScope.userInfo.loanAmount}"
                                                       size="80"
                                                       class="inpMain"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">贷款回执单号</td>
                                            <td>
                                                <input type="text" name="loanNumber" value="${sessionScope.userInfo.loanNumber}"
                                                       size="80"
                                                       class="inpMain"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">贷款类型</td>
                                            <td>
                                                <label>
                                                    <select name="loanType">
                                                        <c:if test="${sessionScope.userInfo.loanType == '农村信用社'}">
                                                            <option value="农村信用社" selected="selected">农村信用社</option>
                                                        </c:if>
                                                        <c:if test="${sessionScope.userInfo.loanType == '开发银行'}">
                                                            <option value="开发银行" selected="selected">开发银行</option>
                                                        </c:if>
                                                        <option value="农村信用社">农村信用社</option>
                                                        <option value="开发银行">开发银行</option>
                                                    </select>
                                                </label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <input name="submit" class="btn" type="submit" value="确认修改"/>
                                            </td>
                                            <td>
                                                <p>${requestScope.message}</p>
                                            </td>

                                        </tr>

                                    </table>
                                </form>
                            </div>
                        </c:when>
                    </c:choose>
                </div>
            </div>
        </div>
    </div>
    <div class="clear"></div>
</div>
</body>
</html>